home *** CD-ROM | disk | FTP | other *** search
- Path: news2.EUnet.fr!enst!orfanos
- From: orfanos@ima.enst.fr
- Newsgroups: comp.lang.c++
- Subject: Re: Stack Fault Error message
- Date: 17 Feb 1996 11:05:14 GMT
- Organization: ENST - France
- Sender: orfanos@news.enst.fr (Dimitri Papadopoulos Orfanos)
- Distribution: world
- Message-ID: <4g4cpa$m65@enst.enst.fr>
- References: <4g3dg2$rsu@ixnews3.ix.netcom.com>
- NNTP-Posting-Host: mathieu-2.enst.fr
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
-
-
- In article <4g3dg2$rsu@ixnews3.ix.netcom.com>,
- rgd@ix.netcom.com (Raymond Dykeman) writes:
- > I am using Borland Turbo C++ 3.0 and am getting Stack Fault
- > error and "Undefined" error messages. I presume this is
- > because I am running low on memory. Can someone confirm/deny
- > this. If so can you reccomend # megs needed.
-
- This has _nothing_ to do with MB of memory available on your
- hardware. DOS will only use 640 kB of them anyway.
-
- On DOS, stack is limited to one segment (64 kB) in Large,
- Medium and Huge models. It is even smaller in Small, Compact
- and Tiny models. Default stack size is pretty small: 4 kB.
- You can increase it up to 64 kB:
-
- extern unsigned _stklen = 40000; // size in bytes
-
- int main() {
- // ...
- }
-
- If you want more stack than 64 kB, you'll have to buy a
- DOS-Extender (I use PowerPack from Borland), or use another
- environment (Windows 95 and NT, OS/2, Unix, etc.).
-
- If these aren't options, try using less stack: make big
- automatic variables (arrays in functions, etc.) static:
-
- void f() {
- int table[10000];
- // ...
- }
-
- should be rewritten as:
-
- void f() {
- static int table[10000];
- // ...
- }
-
- Thus, these variables will be moved from stack segment to data
- segements.
-